package com.sumainfor.pc.cfo.controller.buyer;

import com.sumainfor.common.util.JsonResult;
import com.sumainfor.pc.cfo.service.SettleProductService;
import org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.math.BigDecimal;

/**
 * @Author PuaChen
 * @Create 2018-12-14 11:18
 * 结算单外部暴露服务
 */
@RestController
@RequestMapping("/settle/key")
public class SettleProductController {

    @Autowired
    private SettleProductService sps;


    /**
     * 修改供应商的欠款金额
     *
     * @param supId
     * @param price
     * @return
     */
    @PostMapping("/updateBalanceBySup")
    public JsonResult updateBalanceBySup(String supId, String price) {
        if (StringUtils.isBlank(supId) || StringUtils.isBlank(price)) {
            return JsonResult.errorForEmpty();
        }
        return sps.updateBalanceBySup(supId, new BigDecimal(price));
    }
}
